Skip to content

Add generic TestLogger<T> for strongly-typed logging tests#6

Merged
ncipollina merged 1 commit into
mainfrom
feature/test-helper
Jun 26, 2025
Merged

Add generic TestLogger<T> for strongly-typed logging tests#6
ncipollina merged 1 commit into
mainfrom
feature/test-helper

Conversation

@ncipollina

Copy link
Copy Markdown
Contributor

Summary

  • Add TestLogger<T> class that inherits from TestLogger and implements ILogger<T>
  • Enables unit tests to verify logging behavior for strongly-typed loggers
  • All existing extension methods work automatically through inheritance

Test plan

  • Build compiles successfully
  • All existing tests pass
  • New tests verify generic logger functionality
  • Generic logger can be used where ILogger<T> is expected

🤖 Generated with Claude Code

- Add TestLogger<T> that inherits from TestLogger and implements ILogger<T>
- Enables unit tests to verify logging behavior for strongly-typed loggers
- All existing TestLogger extension methods work automatically through inheritance
- Add comprehensive tests using AwesomeAssertions to verify functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ncipollina
ncipollina requested a review from Copilot June 26, 2025 16:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a generic TestLogger<T> for strongly-typed logging tests and adds a suite of unit tests to verify its behavior.

  • Add TestLogger<T> class inheriting from TestLogger and implementing ILogger<T>
  • Create GenericTestLoggerTests.cs to cover core functionality, extension methods, clearing entries, shared state, and ILogger<T> compatibility

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/LayeredCraft.StructuredLogging/Testing/TestingExtensions.cs Added generic TestLogger<T> class with XML docs
test/LayeredCraft.StructuredLogging.Tests/Testing/GenericTestLoggerTests.cs New tests validating TestLogger<T> behavior
Comments suppressed due to low confidence (1)

test/LayeredCraft.StructuredLogging.Tests/Testing/GenericTestLoggerTests.cs:1

  • The test file is missing the using Xunit; and using FluentAssertions; directives, which are required for the [Fact] attribute and Should() extension methods to compile.
using Microsoft.Extensions.Logging;

@ncipollina
ncipollina merged commit 22251b2 into main Jun 26, 2025
1 check passed
@ncipollina
ncipollina deleted the feature/test-helper branch June 26, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants